﻿//*************************************************************************
//面向服务的协作式智能交通系统仿真软件SoC-ITSS v2.1 alpha
//发布单位：西北工业大学--巴黎高科MINES机器人与群智能系统联合实验室
//团队负责人：张凯龙 Zhang Kailong
//团队成员：张大方、杨安胜、王敏、谢策、王雨佳、谢尘玉等
//联系我们：kl.zhang@nwpu.edu.cn
//2012-2021
//*************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

//*******************************************************
//
//文件名(File Name):           Way.cs
//
//数据表(Tables):              nothing 
//
//          修改理由：         完善属性
//

//*******************************************************
namespace CyberCarSimulation.RoadModel
{
    class Way
    {
        private string ID;                  //道路ID
        private int Angle;                  //道路夹角
        private PointF StartPoint1;         //道路起始位置点坐标1
        private PointF StartPoint2;         //道路起始位置点坐标2
        private PointF EndPoint1;           //道路终止位置点坐标1
        private PointF EndPoint2;           //道路终止位置点坐标2
        private string StartInterID;        //与道路连接的起始路口ID
        private string EndInterID;          //与道路连接的终止路口ID
        private double Weight;              //道路权值
        private float Length;               //道路长度
        private float Width;                //道路宽度
        private string Shape;               //道路形状
        private int LaneNumber;             //道路包含的车道数量
        private List<Lane> LaneList;        //道路包含的车道集合
       

        //无参构造函数
        public Way()
        {
        }

        //有参构造函数
        public Way(string ID, int Angle, PointF StartPoint1, PointF StartPoint2,
            PointF EndPoint1, PointF EndPoint2, string StartInterID, string EndInterID,
            float Weight, float Length, float Width, string Shape,
            int LaneNumber, List<Lane> LaneList)
        {
            this.ID = ID;
            this.Angle = Angle;
            this.StartPoint1 = StartPoint1;
            this.StartPoint2 = StartPoint2;
            this.EndPoint1 = EndPoint1;
            this.EndPoint2 = EndPoint2;
            this.StartInterID = StartInterID;
            this.EndInterID = EndInterID;
            this.Weight = Weight;
            this.Length = Length;
            this.Width = Width;
            this.Shape = Shape;
            this.LaneNumber = LaneNumber;
            this.LaneList = LaneList;
        }

        //获取道路ID
        public string GetID() 
        {
            return this.ID;
        }

        //设置道路ID
        public void SetID(string ID)
        {
            this.ID = ID ;
        }

        //获取道路与水平线夹角
        public int GetAngle()
        {
            return this.Angle;
        }

        //设置道路与水平线夹角
        public void SetAngle(int Angle)
        {
            this.Angle = Angle;
        }
                
        //获取起始点1
        public PointF GetStartPoint1()
        {
            return this.StartPoint1;
        }
        
        //设置起始点1
        public void SetStartPoint1(PointF StartPoint1)
        {
            this.StartPoint1 = StartPoint1;
        }

        //获取起始点2
        public PointF GetStartPoint2()
        {
            return this.StartPoint2;
        }

        //设置起始点2
        public void SetStartPoint2(PointF StartPoint2)
        {
            this.StartPoint2 = StartPoint2;
        }

        //获取终止点1
        public PointF GetEndPoint1()
        {
            return this.EndPoint1;
        }

        //设置终止点1
        public void SetEndPoint1(PointF EndPoint1)
        {
            this.EndPoint1 = EndPoint1;
        }

        //获取终止点2
        public PointF GetEndPoint2()
        {
            return this.EndPoint2;
        }

        //设置终止点2
        public void SetEndPoint2(PointF EndPoint2)
        {
            this.EndPoint2 = EndPoint2;
        }

        //获取起始路口ID
        public string GetStartInter()
        {
            return this.StartInterID;
        }

        //设置起始路口ID
        public void SetStartInter(string StartInterID)
        {
            this.StartInterID = StartInterID;
        }

        //获取终止路口ID
        public string GetEndInter()
        {
            return this.EndInterID;
        }

        //设置终止路口ID
        public void SetEndInter(string EndInterID)
        {
            this.EndInterID = EndInterID;
        }

        //获取道路权值
        public double GetWeight()
        {
            return this.Weight;
        }

        //设置道路权值
        public void SetWeight(double Weight)
        {
            this.Weight = Weight;
        } 

        //获取道路长度
        public float GetLength()
        {
            return this.Length;
        }

        //设置道路长度
        public void SetLength(float Length)
        {
            this.Length = Length;
        }

        //获取道路宽度
        public float GetWidth()
        {
            return this.Width;
        }

        //设置道路宽度
        public void SetWidth(float Width)
        {
            this.Width = Width;
        }

        //获取道路形状
        public string GetShape()
        {
            return this.Shape;
        }

        //设置道路形状
        public void SetShape(string Shape)
        {
            this.Shape = Shape;
        }

        //获取道路包含车道数量
        public int GetLaneNumber()
        {
            return this.LaneNumber;
        }

        //设置道路包含车道数量
        public void GetLaneNumber(int LaneNumber)
        {
            this.LaneNumber = LaneNumber;
        }

        //获取道路包含的车道集合
        public List<Lane> GetLaneList()
        {
            return this.LaneList;
        }

        //设置道路包含的车道集合
        public void SetLaneList(List<Lane> LaneList)
        {
            this.LaneList = LaneList;
        }

        //根据ID寻找车道Lane
        public Lane FindLaneByID(string ID)
        {
            Lane FindLane = new Lane();
            foreach(Lane Lane in this.LaneList)
            {
                if(Lane.GetID().Equals(ID))
                {
                    FindLane = Lane;
                }
            }
            return FindLane;
        }

    }
}
